const express = require('express')
const Schema = require('./schema.js')
const graphqlHTTP = require('express-graphql')

const app = express()
const port = 3002

app.use('/', graphqlHTTP({
    schema: Schema,
    graphiql: true
}))

let server = app.listen(port, function () {
    var addr = server.address()
    var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port
    console.log('Listening on ' + bind)
    console.log('http://127.0.0.1:' + bind + '/graphiql')
    console.log(`{
  user(id: 1) {
    name
  }
}`)

})
